<?php

namespace App\Http\Middleware;

use App\Services\ArticleService;
use Closure;

class ReadUpdate
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $_articleService = new ArticleService();
        $id = $request->route('id');
        $_articleService->addReadNum($id);
        return $next($request);
    }
}
